﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EARS.App_Code;

namespace EARS.App_Code
{
    public class Participation
    {
        public bool Register(string eventName, string userID)
        {
            ParticipationDataClass pdc = new ParticipationDataClass();
            bool check = pdc.checkIfRegistered(userID, eventName);
            if (check == false)
            {
                Account a = new Account();
                string name = a.GetNameByID(userID);
                int contactNo = a.GetContactNoByID(userID);
                string email = a.GetEmailByID(userID);
                pdc.Register(eventName, userID, name, contactNo, email);
            }
            return check;
        }

        public void Unregister(string eventName, string userID)
        {
            ParticipationDataClass pdc = new ParticipationDataClass();
            pdc.Unregister(eventName, userID);
        }

        public List<string> MyEvent(string userID)
        {
            ParticipationDataClass pdc = new ParticipationDataClass();
            List<string> myEvent= pdc.MyEvent(userID);
            return myEvent;
        }

        public List<string> MyEvent(string userID, string dateCreated)
        {
            ParticipationDataClass pdc = new ParticipationDataClass();
            List<string> myEvent = pdc.MyEvent(userID, dateCreated);
            return myEvent;
        }

        public int NumberOfParticipant(string eventName)
        {
            ParticipationDataClass pdc = new ParticipationDataClass();
            int num = pdc.NumberOfParticipant(eventName);
            return num;
        }
    }
}